/*
 * @author: yejiang1015
 * @Date: 2019-03-02 00:19:44
 * @Last Modified by: yejiang1015
 * @Last Modified time: 2019-03-31 23:11:23
 */
import React, {Component} from 'react';
import {hot} from 'react-hot-loader/root';
import {Layout} from 'antd';
import {connect} from 'dva';
import RouteView from '@/components/RouteView';
import SiderMenu from '@/components/SiderMenu';
import Footer from '@/components/Footer';
import Header from '@/components/Header';
const {Content} = Layout;

@connect(({global, main}) => ({
    global,
    userName: global.userName,
    productId: global.productId,
    main
}))
class RouteMain extends Component {
    constructor(props) {
        super(props);
        this.state = {};
    }
    componentDidMount() {
        const {dispatch} = this.props;
        dispatch({
            type: 'global/fetchUserInfo',
            data: {
                userId: 2
            }
        });
    }
    render() {
        const {match} = this.props;
        return (
            <Layout className="ui-vw-100 ui-vh-100">
                <SiderMenu {...this.props} />
                <Layout>
                    <Header {...this.props} />
                    <Content ref="content" style={{margin: '15px', flex: 'none'}}>
                        <section
                            className="bg-fff ui-p-15"
                            style={{
                                minHeight: 100,
                                overflow: 'hidden',
                                borderRadius: '4px 4px 0 0'
                            }}
                        >
                            <RouteView routesKey={match.path} />
                        </section>
                    </Content>
                    <Footer {...this.props} />
                </Layout>
            </Layout>
        );
    }
}
export default hot(RouteMain);
